<meta charset="utf-8">
(#) WebP Unsupported

!!! ERROR: WebP Unsupported
   This is an error.

Id
:   `WebpUnsupported`
Summary
:   WebP Unsupported
Severity
:   Error
Category
:   Usability: Icons
Platform
:   Android
Vendor
:   Android Open Source Project
Feedback
:   https://issuetracker.google.com/issues/new?component=192708
Since
:   2.3.0 (March 2017)
Affects
:   Kotlin and Java files, manifest files and resource files
Editing
:   This check can *not* run live in the IDE editor
Implementation
:   [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/IconDetector.java)
Tests
:   [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/IconDetectorTest.java)

The WebP format requires Android 4.0 (API 15). Certain features, such as
lossless encoding and transparency, requires Android 4.2.1 (API 18; API
17 is 4.2.0.)

!!! Tip
   This lint check has an associated quickfix available in the IDE.

(##) Example

Here is an example of lint warnings produced by this check:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
res/drawable-mdpi/my_lossy.webp:Error: WebP requires Android 4.0 (API
15); current minSdkVersion is 10 [WebpUnsupported]
4 errors, 0 warnings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here are the relevant test files:

![res/drawable-mdpi-v15/my_lossy.webp](examples/drawable-mdpi-v15/my_lossy.webp)

![res/drawable-mdpi/my_lossy.webp](examples/drawable-mdpi/my_lossy.webp)

![res/mipmap-mdpi/my_lossless.webp](examples/mipmap-mdpi/my_lossless.webp)

![res/drawable-mdpi-v13/my_lossless.webp](examples/drawable-mdpi-v13/my_lossless.webp)

![res/drawable-mdpi-v16/my_lossless.webp](examples/drawable-mdpi-v16/my_lossless.webp)

![res/drawable-mdpi-v18/my_lossless.webp](examples/drawable-mdpi-v18/my_lossless.webp)

![res/drawable-mdpi/ic_launcher.webp](examples/drawable-mdpi/ic_launcher.webp)

You can also visit the
[source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/IconDetectorTest.java)
for the unit tests for this check to see additional scenarios.

The above example was automatically extracted from the first unit test
found for this lint check, `IconDetector.testWebpUnsupported`.
To report a problem with this extracted sample, visit
https://issuetracker.google.com/issues/new?component=192708.

(##) Suppressing

You can suppress false positives using one of the following mechanisms:

* Using a suppression annotation like this on the enclosing
  element:

  ```kt
  // Kotlin
  @Suppress("WebpUnsupported")
  fun method() {
     problematicStatement()
  }
  ```

  or

  ```java
  // Java
  @SuppressWarnings("WebpUnsupported")
  void method() {
     problematicStatement();
  }
  ```

* Using a suppression comment like this on the line above:

  ```kt
  //noinspection WebpUnsupported
  problematicStatement()
  ```

* Adding the suppression attribute `tools:ignore="WebpUnsupported"` on
  the problematic XML element (or one of its enclosing elements). You
  may also need to add the following namespace declaration on the root
  element in the XML file if it's not already there:
  `xmlns:tools="http://schemas.android.com/tools"`.

  ```xml
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;manifest xmlns:tools="http://schemas.android.com/tools"&gt;
      ...
      &lt;application tools:ignore="WebpUnsupported" .../&gt;
    ...
  &lt;/manifest&gt;
  ```

* Using a special `lint.xml` file in the source tree which turns off
  the check in that folder and any sub folder. A simple file might look
  like this:
  ```xml
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;lint&gt;
      &lt;issue id="WebpUnsupported" severity="ignore" /&gt;
  &lt;/lint&gt;
  ```
  Instead of `ignore` you can also change the severity here, for
  example from `error` to `warning`. You can find additional
  documentation on how to filter issues by path, regular expression and
  so on
  [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html).

* In Gradle projects, using the DSL syntax to configure lint. For
  example, you can use something like
  ```gradle
  lintOptions {
      disable 'WebpUnsupported'
  }
  ```
  In Android projects this should be nested inside an `android { }`
  block.

* For manual invocations of `lint`, using the `--ignore` flag:
  ```
  $ lint --ignore WebpUnsupported ...`
  ```

* Last, but not least, using baselines, as discussed
  [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).

<!-- Markdeep: --><style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="markdeep.min.js" charset="utf-8"></script><script src="https://morgan3d.github.io/markdeep/latest/markdeep.min.js" charset="utf-8"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>